﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ERPStudio;

namespace ResUma
{
    public partial class LocuriVacanteFrm : FrmRezumat
    {
        public LocuriVacanteFrm(ModuleClass mInfo)
            : base(mInfo)
        {
            InitializeComponent();
        }

        private void LocuriVacanteFrm_Load(object sender, EventArgs e)
        {

            this.pFunctiiTableAdapter.Connection = DeschideConexiune("ESRPConnectionString"); ;
            this.pLocMuncaTableAdapter.Connection = this.pFunctiiTableAdapter.Connection;
            this.pLocMuncaTableAdapter.Fill(this.persSalDataSet.Departamente,ModuleInfo.CodUnitate);
            
            this.pFunctiiTableAdapter.Fill(this.persSalDataSet.Ocupatii);
            this.dsc_PosturiVacanteTableAdapter.Connection = this.pFunctiiTableAdapter.Connection;
            this.dsc_PosturiVacanteTableAdapter.Fill(this.persSalDataSet.PosturiVacante);
            
            
            this.listBndSourceMain.Add(this.dsc_PosturiVacanteBindingSource);
            this.listTableAdaptor.Add(this.dsc_PosturiVacanteTableAdapter.Adapter);


            AddButton("Salvare", global::ERPStudio.Properties.Resources.salvare1, Salvare, ToolStripItemAlignment.Right, true);
        }

        private void dsc_PosturiVacanteDataGridView_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            this.dsc_PosturiVacanteDataGridView.Rows[e.RowIndex].Cells["SPEC"].Value =
            this.dsc_PosturiVacanteDataGridView.Rows[e.RowIndex].Cells["COD_LM"].EditedFormattedValue;

            this.dsc_PosturiVacanteDataGridView.Rows[e.RowIndex].Cells["FUNCTIA"].Value =
            this.dsc_PosturiVacanteDataGridView.Rows[e.RowIndex].Cells["COD_FUNC"].EditedFormattedValue;

        }

        private void LocuriVacanteFrm_FormClosing(object sender, FormClosingEventArgs e)
        {
            InchideConexiune(this.pFunctiiTableAdapter.Connection);
        }
    }
}
